import request from '@/utils/request'

// 查询节目列表
export function listProgram(query) {
  return request({
    url: '/ips/program/list',
    method: 'get',
    params: query
  })
}

// 添加频道内查询节目列表
export function ListQueryProgram(query) {
  return request({
    url: '/ips/program/ListQuery',
    method: 'get',
    params: query
  })
}

// 查询节目详细
export function getProgram(id) {
  return request({
    url: '/ips/program/' + id,
    method: 'get'
  })
}

// 新增节目
export function addProgram(data) {
  return request({
    url: '/ips/program/save',
    method: 'post',
    data: data
  })
}

// 修改节目
export function editProgram(data) {
  return request({
    url: '/ips/program/update',
    method: 'put',
    data: data
  })
}

// 复制节目
export function copyProgram(data) {
  return request({
    url: '/ips/program/copy',
    method: 'post',
    data: data
  })
}

// 分组移至
export function moveTo(ids, groupId, groupName) {
  return request({
    url: '/ips/program/moveTo/' + ids + '/' + groupId + '/' + groupName,
    method: 'put'
  })
}

// 删除节目
export function delProgram(id) {
  return request({
    url: '/ips/program/remove/' + id,
    method: 'delete'
  })
}

// 导出节目
export function exportProgram(query, id) {
  return request({
    url: `/ips/program/exportProgram?id=${id}`,
    method: 'post',
    params: query,
    responseType: 'blob',
  })
}
// 导入节目
export function importProgram(groupName,programName,data) {
  return request({
    url: `/ips/program/importProgram/${groupName}/${programName}`,
    method: 'post',
    data
  })
}

// 导出应用日志
export function queryRegion() {
  return request({
    url: '/ips/api/queryRegion',
    method: 'get'
  })
}
